package ${basePackage}.service.impl;

import ${basePackage}.dao.${modelNameUpperCamel}Mapper;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.service.${modelNameUpperCamel}Service;
import ${basePackage}.framework.core.AbstractService;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;

import javax.annotation.Resource;
import java.util.List;


/**
* @author ${author}
* @version ${date}
*/
@Service
@Transactional
@CacheConfig(cacheNames = {"cache"})
public class ${modelNameUpperCamel}ServiceImpl extends AbstractService<${modelNameUpperCamel}> implements ${modelNameUpperCamel}Service {

@Resource
private ${modelNameUpperCamel}Mapper ${modelNameLowerCamel}Mapper;

@Override
public void save(${modelNameUpperCamel}  model) {
super.save(model);
}

@Override
public void save(List<${modelNameUpperCamel}> models) {
super.save(models);
}

@Override
@CacheEvict(key = "'${modelNameLowerCamel}:' + #id")
public void deleteById(Integer id) {
super.deleteById(id);
}

@Override
public void deleteByIds(String ids) {
super.deleteByIds(ids);
}

@Override
@CachePut(key = "'${modelNameLowerCamel}:' + #model.id")
public void update(${modelNameUpperCamel}  model) {
super.update(model);
}

@Override
@Cacheable(key = "'${modelNameLowerCamel}:' + #id")
public ${modelNameUpperCamel}  findById(Integer id) {
return super.findById(id);
}

@Override
public ${modelNameUpperCamel}  findBy(String fieldName, Object value) throws TooManyResultsException {
return super.findBy(fieldName, value);
}

@Override
public List<${modelNameUpperCamel}> findByIds(String ids) {
return super.findByIds(ids);
}

@Override
public List<${modelNameUpperCamel}> findByCondition(Condition condition) {
return super.findByCondition(condition);
}

@Override
public List<${modelNameUpperCamel}> findAll() {
return super.findAll();
}

}
